package com.mall.controller;


import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
import com.mall.db.domain.Address;
import com.mall.db.service.AddressService;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;
import java.util.List;
import java.util.Map;

/**
 * <p>
 *  前端控制器
 * </p>
 *
 * @author qhb
 * @since 2021-09-24
 */
@RestController
@RequestMapping("/system/ac")
public class AddressController extends BaseController<Address> {

    @Resource(name = "addressService")
    private AddressService as;

    @Override
    public Map<String, Object> find(Address address) {
        PageHelper.startPage(address.getPage(), address.getLimit());
        QueryWrapper<Address> qw = new QueryWrapper<>();
        List<Address> list = as.list(qw);
        PageInfo<Address> page = new PageInfo<>(list, address.getLimit());
        return this.findMap(page.getList(), page.getTotal());
    }
}

